@extends('layouts.layouts')
@section('title')
    <title>后台首页</title>
@endsection
@section('content')
    <link rel="stylesheet" href="/lib/layer/theme/default/layer.css"/>
    <script type="text/javascript" src="/lib/layer/layer.js"></script>
    <div class="content">
        <div class="header">
            <ul class="breadcrumb">
                <li><a href="/admin/share">裂变者</a></li>
                <li class="active">裂变者列表</li>
            </ul>
        </div>
        <div class="main-content">
            <div class="btn-toolbar list-toolbar">
                <form class="form-inline" action="/admin/excel" method="get">
                    <button type="button" onclick="history.go(-1);" class="btn btn-primary">返回</button>
                   <!-- <a href="/activity/add"><button type="button" class="btn btn-primary" data-toggle="modal" data-target="#exampleModal" ><i class="fa fa-plus"></i> 新增</button></a>-->
                    <!-- <div class="form-group">
                        <input type="text" class="form-control" name="tel" placeholder="裂变者手机号" value="">
                    </div> -->

                    <div class="form-group">
                        <input type="text" class="form-control startTime" name="start" onfocus="WdatePicker({dateFmt:'yyyy-MM-dd'})" placeholder="开始时间" value="" />
                    </div>
                    <div class="form-group">
                        <input type="text" class="form-control endTime" name="end" onfocus="WdatePicker({dateFmt:'yyyy-MM-dd'})"  placeholder="结束时间" value="" />
                    </div>
                    <input type="hidden" name="username" value="{{$curname}}" />
                    <input type="hidden" name="user_id" value="{{$user_id}}" />
                    @if($is_fission==2)
                    <button type="button" class="btn btn-default download_excel">导出</button>
                    @endif
                </form>
            </div>
            <script type="text/javascript">
                $(document).ready(function(){
                    $(".download_excel").click(function(){
                        var start_time = $("input[name='start']").val();
                        var end_time   = $("input[name='end']").val();
                        if(start_time>end_time){
                            alert("时间选择不对");
                            return;
                        }else{
                            $(this).parent().submit();
                        }
                    });
                });
            </script>
            <div class="row">
                <div class="col-sm-12 col-md-12">
                    <div class="panel panel-default">
                        <div class="panel-heading no-collapse" style="text-align:center;font-size:15px;">{{$curname}}</div>
                        <table class="table table-bordered table-striped">
                            <thead>
                            <tr>
                                <th>编号</th>
                                <th>姓名</th>
                                <th>工作标签</th>
                                <th>电话</th>
                                <th>开始时间</th>
                            </tr>
                            </thead>
                            <tbody>
                            @if($data[0])
                                @foreach($data as $v)
                                    <tr>
                                        <td>{{$v->user_id}}</td>
                                        <td>{{$v->name}}</td>
                                        <td>{{$v->worktag}}</td>
                                        <td>{{$v->mobile}}</td>
                                        <td>{{$v->created_at}}</td>
                                    </tr>
                                @endforeach
                            @else
                                <tr><td colspan = "5" style="text-align:center;">暂无信息</td></tr>
                            @endif

                            </tbody>
                        </table>

                    </div>

                </div>
                {{$data->appends(['is_fission'=>$is_fission])->render()}}
            </div>

        </div>
    </div>
  
@endsection